<?php

    $dir = pathinfo($_SERVER['SCRIPT_FILENAME']); 

    if (ini_set("include_path",ini_get("include_path").((strtoupper(PHP_OS) == "LINUX") ? ":" : ";").$dir['dirname']) === false) {
            echo "ERROR: Definicion en el include_path";
            exit;
    }

    include('../adodb/adodb.inc.php');
    include_once('../adodb/adodb-pager.inc.php');
    include_once('../conf/dbconn_param.php');
	
    $db = ADONewConnection($dbdriver);
    $db->Connect($server, $user, $password, $database);
    $db->SetFetchMode(ADODB_FETCH_ASSOC);

    $db->debug = false;
	
    $activo = 1;
	
    $sql1 = "SELECT valor FROM `finca_param` WHERE finca_param_id = 14 ";
    $sql2 = "SELECT valor FROM `finca_param` WHERE finca_param_id = 13 ";
    
    $rs1 = $db->Execute($sql1);
    $rs2 = $db->Execute($sql2);
    
    $datos1 = $rs1->GetRows();
    $datos2 = $rs2->GetRows();
    
    $diaMaxDispo = $datos1[0]['valor'];
    $diaDefDispo = $datos2[0]['valor'];
	
    $i = 0;

    for ($i = $diaMaxDispo; $i > 0 ; $i--) {
        echo $i;
        if ( $i == $diaDefDispo )
        {
            echo "<option value=\"$i\" selected=\"selected\">".$i."</option>";
        }
        else
        {
            echo "<option value=\"$i\">".$i."</option>";
        }
    }    
    
    $db->Close;
?>	